using System;
using Provausio.Common.Objects;
using TrainingManagement.api.Models.Data.CRUD;
using TrainingManagement.api.Models.Data.CRUD.TrainingRecord;

namespace TrainingManagement.api.Models.BusinessLogic.TrainingRecord
{
    public class TrainingRecordDeleteOperation : BusinessOperation<int, bool>
    {
        readonly TrainingRecordDeleteDataSource _recordDelete = new TrainingRecordDeleteDataSource();

        public override bool Run(int input)
        {
            if (_recordDelete.Execute(input))
                return true;
            throw new Exception(string.Format("Record {0} failed to delete!", input));
        }
    }
}